package com.dailyblue.project.estate.car.controller;

import com.dailyblue.project.estate.car.service.CarService;
import com.dailyblue.project.estate.commons.bean.Car;
import com.dailyblue.project.estate.commons.util.JsonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/car")
public class CarController {
    @Resource
    private CarService carService;

    @PostMapping
    public JsonResult save(Car car) {
        return carService.addCar(car);
    }

    @GetMapping
    public JsonResult find() {
        return carService.find();
    }
}
